package com.tmsps.auto.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.ne.framework.data.page.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ModelAttribute;

/**
 * 基础Action类，预先设置通用参数 Page，pageMessage，Condition
 * 
 * @author ring
 */
public class BaseAction {
	protected Logger log = LoggerFactory.getLogger(getClass());

	public Page page = new Page();
	// 操作结果提示与说明(例如:操作成功)
	public Tip tip = new Tip();

	public void setTipMsg(String msg) {
		this.setTipMsg(msg, Tip.Type.information);
	}

	public void setTipMsg(String msg, Tip.Type type) {
		tip.setMsg(msg);
		tip.setType(type);
	}
	
	protected HttpServletRequest request;
	protected HttpServletResponse response;

	/**
	 * 注入request response
	 * 
	 * @param request
	 * @param response
	 */
	@ModelAttribute
	public void setReqAndRes(HttpServletRequest request,
			HttpServletResponse response) {
		this.request = request;
		this.response = response;
	}

}
